package org.vehicle.vo;

import java.util.List;
import java.util.Map;

/**
 * 搜索结果对象
 * @author Administrator
 *
 */
public class SearchResult {
	private List<?> data;
	private Integer page;
	private Integer pageSize;
	private Integer total;
	private Integer pageCount;//总共分几页
	private List<?> exportData;//导出excel数据
	
	public void calcPageCount(){
		//计算总共多少页
		if(this.total!=null&&this.pageSize!=null){
			this.pageCount=this.total%this.pageSize==0?this.total/this.pageSize:this.total/this.pageSize+1;
		}
	}
	
	public Integer getPageCount() {
		return pageCount;
	}
	public void setPageCount(Integer pageCount) {
		this.pageCount = pageCount;
	}
	public List<?> getData() {
		return data;
	}
	public void setData(List<?> data) {
		this.data = data;
	}
	public Integer getPage() {
		return page;
	}
	public void setPage(Integer page) {
		this.page = page;
	}
	public void setPage(Object page) {
		this.page = (Integer)page;
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public void setPageSize(Object pageSize) {
		this.pageSize = (Integer)pageSize;
	}
	public Integer getTotal() {
		return total;
	}
	public void setTotal(Integer total) {
		this.total = total;
	}
	public List<?> getExportData() {
		return exportData;
	}
	public void setExportData(List<?> exportData) {
		this.exportData = exportData;
	}
	public SearchResult() {
		this.page=1;
		this.pageSize=10;
		this.total=0;
	}
	public SearchResult(List<?> data, Integer page, Integer pageSize, Integer total) {
		this.data = data;
		this.page = page;
		this.pageSize = pageSize;
		this.total = total;
	}
	public SearchResult(List<?> data, Object page, Object pageSize, Integer total) {
		this.data = data;
		this.page = (Integer) page;
		this.pageSize = (Integer) pageSize;
		this.total = this.pageSize==0?0:total;
	}
	public SearchResult(List<?> data,Integer total,Map<String,Object> maps) {
		this.data = data;
		this.page = (Integer) maps.get("page");
		this.pageSize = (Integer) maps.get("pageSize");
		this.total = this.pageSize==0?0:total;
	}
	public void setPageAndPageSizeByMap(Map<String,Object> maps){
		this.setPage((Integer)maps.get("page"));
		this.setPageSize((Integer)maps.get("pageSize"));
		this.calcPageCount();
	}
	
}
